import json

d = {"name":"张三","age":22,"job":"程序员"}
print(type(d))

# s = json.dumps(d,ensure_ascii=False,indent=4)
#此时的s是字符串
# print(s,type(s))

with open('t.json','w',encoding='utf-8') as f:
    json.dump(d,f,ensure_ascii=False,indent=2)